package wjh.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import wjh.mapper.wyMessageMapper;
import wjh.pojo.Message;

import java.util.List;
@Service
public class wyMessageImpl implements wyMessageService {
    @Autowired
    private wyMessageMapper messageMapper;
    @Override
    public List<Message> like(String likename) {
        List<Message> like = messageMapper.like(likename);
        return like;
    }

    @Override
    public List<Message> findAll() {
       return messageMapper.findAll();
    }



    @Override
    public void deleteMessageByid(String ids) {
        String[] idArray = ids.split("-");
        for (String id : idArray) {
            if (!id.isEmpty()) {
                messageMapper.deleteMessageByid(Integer.parseInt(id));
            }
        }
    }

    @Override
    public void addMessage(Message message) {
messageMapper.addMessage(message);
    }

    @Override
    public Message findMessageById(int id) {
        return messageMapper.findMessageById(id);
    }

    @Override
    public void updateMessage(Message message) {
        messageMapper.updateMessage(message);
    }


}
